#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

vector<int> tmp;

vector<int> sortArray(vector<int>& nums) {
    tmp.resize(nums.size());

    mergesort(nums, 0, nums.size() - 1);

    return nums;
}

void mergesort(vector<int>& nums, int left, int right)
{
    if (left >= right)
        return;

    int mid = (left + right) >> 1;

    mergesort(nums, left, mid);
    mergesort(nums, mid + 1, right);

    int cur1 = left, cur2 = mid + 1;
    int i = 0;

    while (cur1 <= mid && cur2 <= right)
        tmp[i++] = nums[cur1] <= nums[cur2] ? nums[cur1++] : nums[cur2++];

    while (cur1 <= mid)
    {
        tmp[i++] = nums[cur1++];
    }
    while (cur2 <= right)
    {
        tmp[i++] = nums[cur2++];
    }

    for (int i = left; i <= right; ++i)
        nums[i] = tmp[i - left];
}

int main()
{

	return 0;
}